﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SDT.Site.ViewModels.ProjectListModels>" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>
<div class="duan">
    <div class="tit_duan">DỰ ÁN NỔI BẬT</div>
    <div class="list_duan">
	    <ul>
            <%foreach (var type in Model.ProjectLegals){%>
                <%if (type.ID == 1)
                  { %>
                <li><a id="cont-<%=type.ID %>" href="#projectTabs-<%=type.ID %>" class="tabLink act"><%=Html.Encode(type.Name)%></a></li>
                <%}
                  else
                  { %>
                 <li><a id="cont-<%=type.ID %>" href="#projectTabs-<%=type.ID %>" class="tabLink"><%=Html.Encode(type.Name)%></a></li> 
                <%} %>
            <%} %>
        </ul>	    
    </div>
    <div class="clear"></div>
    <div class="tabrec_cnt" style="min-height: 141px;">
		<%foreach (var type in Model.ProjectLegals)
        {
        //var l = type.Projects.Where(e => e.HotYN == true).OrderByDescending(e=>e.ID).Take(4).ToList();
        var l = type.Projects.OrderByDescending(e => e.ID).Take(4).ToList();
        var chide = type.ID == 1 ? "" : "hide";
        %>
		<div class="duan_cate tabcontent <%=chide %>" align="center" id="cont-<%=type.ID %>-1">
        	<ul>
                <%foreach (var item in l)
                  { %>
                <li>
                    <% string imgPath = (item.ImagePath != null && item.ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(item.ID, 128, 92, item.ImagePath, Model.ImagePath, Model.ImageUrl) : SDT.Lib.Common.Globals.DefaultLogo; %>
                    
                    <div><a href="/project/details/<%=item.ID %>/<%=Html.ToUrlFriendly(item.Title)%>"><img alt="<%=Html.Encode(item.Title) %>" src="<%=imgPath %>" class="bor_img" width="128" height="92" /></a></div>
                    <div><a href="/project/details/<%=item.ID %>/<%=Html.ToUrlFriendly(item.Title)%>"><strong><%=Html.Encode(item.Title)%></strong></a></div>
                </li>
                <%} %>
            </ul>
        </div>
        <%} %>
        <div class="clear"></div>
	</div>
 </div>
<script type="text/javascript">
    $(document).ready(function() {
        $(".tabLink").each(function() {
            $(this).click(function() {
                tabeId = $(this).attr('id');
                $(".tabLink").removeClass("act");
                $(this).addClass("act");
                $(".tabcontent").addClass("hide");
                $("#" + tabeId + "-1").removeClass("hide")
                return false;
            });
        });
    });
</script>